﻿
CREATE proc [dbo].[proc_Customer_Track_GetList_ByUserId]
	(
		@UserId varchar(20),
		@CreateDate varchar(10)
	)
As
Begin
	Declare @sRq Datetime,@eRq Datetime
	Set @sRq = Convert(Datetime,@CreateDate+' 00:00:00')
	Set @eRq = Convert(Datetime,@CreateDate+' 23:59:59')

	Select
	IsNull((Select CustomerName From Customer Where CustomerId=T.CustomerId),'---') As CustName,
	UpTime,
	IsNull((Select Top 1 EName From Employee Where UserName=T.UpName),'...') As EName,
	IsNull((Select Top 1 Title From Customer_Genjin Where Id=T.GenjinId),'...') As Genjin,
	Record
	From Customer_Track T
	Where UpTime>=@sRq And UpTime<=@eRq And UpName=@UserId
	Order by UpTime
End